<template>
  <div>
    <el-card class="vip">
      <!-- 返回操作 -->
      <div slot="header" @click="backClick" class="clearfix vip_header">
        <i></i>
        <h2>返回</h2>
      </div>
      <div class="vip_body">
        <!-- tab栏 -->
        <el-tabs v-model="activeName" @tab-click="handleClick">
          <!-- vip -->
          <el-tab-pane label="VIP" name="first">
            <!-- 会员表格 -->
            <el-table
              :header-cell-style="{background:'#E9F4FD',color:'#212121'}"
              :data="tableData"
              style="width: 100%"
            >
              <el-table-column type="selection" width="55"></el-table-column>
              <el-table-column prop="date" label="会员等级"></el-table-column>
              <el-table-column prop="name" label="会员费用"></el-table-column>
              <el-table-column fixed="right" label="操作">
                <template slot-scope="scope">
                  <el-button @click="handleClickvip(scope.row)" type="text">修改</el-button>
                  <el-button type="text" @click="delClick(scope.$index)">删除</el-button>
                </template>
              </el-table-column>
            </el-table>
          </el-tab-pane>
          <!-- 积分 -->
          <el-tab-pane label="积分" name="second">
            <!-- 积分表格 -->
            <el-table
              :header-cell-style="{background:'#E9F4FD',color:'#212121'}"
              :data="tableData"
              style="width: 100%"
            >
              <el-table-column type="selection" width="55"></el-table-column>
              <el-table-column prop="date" label="积分等级"></el-table-column>
              <el-table-column prop="name" label="积分费用"></el-table-column>
              <el-table-column fixed="right" label="操作">
                <template slot-scope="scope">
                  <el-button @click="handleClickIntegral(scope.row)" type="text">修改</el-button>
                  <el-button type="text">删除</el-button>
                </template>
              </el-table-column>
            </el-table>
          </el-tab-pane>
        </el-tabs>
        <!-- 按钮 -->
        <div class="btn">
          <el-button @click="newaddGrade" v-if="activeName=='first'">+新增等级</el-button>
          <el-button @click="newaddIntegral" v-else>+新增积分</el-button>
          <el-button>-删除等级</el-button>
        </div>
      </div>
      <!-- 模态框 -->
      <el-dialog class="delete vipDialog_btn" :visible.sync="Isdelete" :showClose="showClo=false" width="661px">
        <i @click="Isdelete= false"></i>
        <i></i>
        <h2 class="deldj">删除
          {{text}}这一等级
        </h2>
        <p class="pp">
          你确定删除该等级吗？用户信息请及时安排。
        </p>
        <span slot="footer" class="dialog-footer">
          <el-button @click="handleSure">确 定</el-button>
          <el-button @click="Isdelete = false">取 消</el-button>
        </span>
      </el-dialog>
    </el-card>
  </div>
</template>


<script>
export default {
  // tab栏切换
  data() {
    return {
      text: '普通会员',
      index: 0,
      // tab栏默认选中
      activeName: "first",
      //   表格
      tableData: [
        {
          date: "普通用户",
          name: "0元"
        },
        {
          date: "月会员",
          name: "68元/月"
        },
        {
          date: "季会员",
          name: "98元/季"
        },
        {
          date: "年会员",
          name: "158元/年"
        }
      ],
      Isdelete: false
    };
  },
  methods: {
    backClick() {
      this.$router.go(-1)
    },
    // 点击切换
    handleClick(tab, event) {
      // console.log(tab, event);
      console.log(this.activeName);
      

    },
    handleSuccess(response, file, fileList) {
      console.log(response);
      console.log(file);
      console.log(fileList);
      this.uploadImg = fileList.length;
      console.log(this.uploadImg);
    },
    beforeRemove(file, fileList) {
      return this.$confirm(`确定移除 ${file.name}？`);
    },
    // 点击修改vip
    handleClickvip(scopeRow) {
      console.log(scopeRow);
      this.$router.push("./modify");
    },
    // 点击修改积分
    handleClickIntegral() {
        this.$router.push('./modifyIntegral')
    },  
    // 点击删除vip
    delClick(index) {
      console.log(index);
      this.index = index;
      this.Isdelete = true;
    },
    // 模态框确定删除
    handleSure() {
      this.Isdelete = false;
      //   console.log(this.type);
      this.tableData.splice(this.index, 1);
    },
    // 新增等级
    newaddGrade() {
        // console.log(11);
        this.$router.push('./addDegree')
    },
    // 新增积分
    newaddIntegral() {
      this.$router.push('./addIntegral')
    }
  }
};
</script>

<style>
/* 头部信息 */
.vip_header {
  margin-top: 16px;
  margin-left: 50px;
  position: relative;
  /* border-bottom: 1px solid red; */
}
.vip_header h2 {
  display: inline-block;
  margin: 0;
  margin-left: 12px;
  /* position: absolute; */
  font-size: 20px;
  font-weight: 400;
  color: #3f51b5;
}
.vip_header i {
  /* position: absolute;
  top: 5px;
  left: 0; */
  display: inline-block;
  width: 10px;
  height: 20px;
  background: url("../assets/img/left.png") no-repeat;
  background-size: 10px 20px;
  vertical-align: middle;
}

/* tab */
.vip .el-card__body {
  margin: 8px 80px 34px;
}
.vip .el-tabs__item.is-active {
  background-color: #3040a0;
  color: #fff;
  border-radius: 5px 5px 0 0;
}
.vip .el-tabs--top .el-tabs__item.is-top:nth-child(2) {
  padding-left: 20px;
  padding: 0 44px;
}
.vip .el-tabs--top .el-tabs__item.is-top:last-child {
  padding-right: 20px;
  padding: 0 44px;
}
.vip .el-tabs__nav-wrap::after {
  background-color: #3040a0;
}
.vip .el-tabs__active-bar {
  background-color: #3040a0;
}
.vip_body {
  position: relative;
}
.vip_body .el-tabs__nav-wrap::after {
  width: 226px;
}
/* 按钮 */
.vip .btn {
  position: absolute;
  top: 0;
  right: 0;
}
.vip_body .btn .el-button {
  border-radius: 5px;
  border: none;
  font-size: 16px;
  color: #ffffff;
}
.vip_body .btn .el-button:nth-child(1) {
  background: #ff3c00;
}
.vip_body .btn .el-button:nth-child(2) {
  background: #bdbdbd;
}
/* 表格 */
.vip_body .el-table th > .cell {
  font-weight: 700;
  font-size: 22px;
}
.vip_body .el-table .cell,
.vip_body .el-button {
  font-size: 18px;

  color: #212121;
}
/* 模态框 */
.delete i:nth-child(1) {
  /* display: block; */
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  background: url("../assets/img/close.png") no-repeat;
  background-size: 38px;
}
.delete i:nth-child(2) {
  display: block;
  width: 40px;
  height: 40px;
  background: url("../assets/img/garbage.png") no-repeat;
  background-size: 40px;
  margin: 0 auto;
}
.deldj {
  font-size: 24px;
color: #212121;
text-align: center;
}
.pp {

font-size: 16px;
text-align: center;
color: #757575;

}
.vipDialog_btn .el-dialog__footer{
  text-align: center;
}
.vipDialog_btn .el-button {
  width: 240px;
height: 47px;
background: #ffffff;
border: 1px solid rgba(0,0,0,0.1);
border-radius: 10px;
color: #757575;
}
.vipDialog_btn .el-button:nth-child(1) {
  background: url('../assets/img/btn.png') no-repeat;
  border: none;
  color: #fff;
}
</style>